﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.Coolzon.UI.Script
{
    public class PanelScriptObject: PartScriptObject
    {
        private WeakReference _panel;
        public PanelScriptObject(PanelPart panel)
            : base(panel)
        {
            _panel = new WeakReference(panel);
        }

        public object getObject(string name)
        {
            PanelPart panel = _panel.Target as PanelPart;
            if (panel == null)
            {
                return null;
            }
            UI.Part part = panel.GetChildPart(name, true);
            if (part != null)
            {
                return part.GetScriptObj();
            }
            return null;
        }
    }
}